<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">

<title>class DRb::DRbServer - drb: Ruby Standard Library Documentation</title>


<script src="../js/navigation.js" defer></script>
<script src="../js/search.js" defer></script>
<script src="../js/search_index.js" defer></script>
<script src="../js/searcher.js" defer></script>
<script src="../js/darkfish.js" defer></script>

<script src="../js/jquery-3.2.0.min.js"></script>

<script src="../js/vue.min.js"></script>
<script src="../js/js.cookie.min.js"></script>

<link href="../css/fonts.css" rel="stylesheet">
<link id='rdoccss' href="../css/rdoc.css" rel="stylesheet">
<link href="../css/carbon17.css" rel="stylesheet">

<script type="text/javascript">
  var rdoc_rel_prefix = "../";
  var index_rel_prefix = "../";
  var darkModeCsseHref = "../css/rdoc-dm.css"
  var defaultModeCssHref = "../css/rdoc.css"
  // var cssDarkmode = Cookies.get('darkmode');
  
  if( Cookies.get("darkmode") == "true") {
	$('#rdoccss').attr("href", darkModeCsseHref);
}

//  https://cssdeck.com/blog/simple-jquery-stylesheet-switcher/

document.write('<style type="text/css">body{display:none}</style>');

</script>


</head>
<body id="top" role="document" class="class">
  <!-- this is class.html -->

  <div id='actionbar' >
    <div class='wrapper mdiv'>
      <ul class='grids g0'></ul>
    </div> 
    <!-- VERSION HEADER for 3.3.0.preview2 NOT FOUND -->
  </div> <!-- end action bar -->

  <div class='wrapper hdiv'>

    


    <nav id='vapp' role="navigation">
    <div id="project-navigation">
      <div id="home-section" role="region" title="Quick navigation" class="nav-section">
  <h2><a href="../index.html" rel="home">Home</a></h2>

  <div id="table-of-contents-navigation"  >
    <a href="../table_of_contents.html#pages">Pages</a>
    <a href="../table_of_contents.html#classes">Classes</a>
    <a href="../table_of_contents.html#methods">Methods</a>
  </div>
</div>

      <div id="search-section" role="search" class="project-section initially-hidden">
  <form action="#" method="get" accept-charset="utf-8">
    <div id="search-field-wrapper">
      <input id="search-field" role="combobox" aria-label="Search"
             aria-autocomplete="list" aria-controls="search-results"
             type="text" name="search" placeholder="Search" spellcheck="false"
             title="Type to search, Up and Down to navigate, Enter to load">
    </div>

    <ul id="search-results" aria-label="Search Results"
        aria-busy="false" aria-expanded="false"
        aria-atomic="false" class="initially-hidden"></ul>
  </form>
</div>

    </div>


    

    <button id='toggleThing' @click="toggleNav()" >Show/hide navigation</button>
    <div :class="isOpen ? 'block' : 'hidden' " id='toggleMe'>
      <div id="class-metadata">
        
        
<div id="parent-class-section" class="nav-section">
  <h3>Parent</h3>

  <p class="link"><a href="../Object.html">Object</a>
</div>

        
        
        
<!-- Method Quickref -->
<div id="method-list-section" class="nav-section">
  <h3>Methods</h3>

  <ul class="link-list" role="directory">
    <li ><a href="#method-c-default_acl">::default_acl</a>
    <li ><a href="#method-c-default_argc_limit">::default_argc_limit</a>
    <li ><a href="#method-c-default_id_conv">::default_id_conv</a>
    <li ><a href="#method-c-default_load_limit">::default_load_limit</a>
    <li ><a href="#method-c-new">::new</a>
    <li ><a href="#method-c-verbose">::verbose</a>
    <li ><a href="#method-c-verbose-3D">::verbose=</a>
    <li ><a href="#method-i-alive-3F">#alive?</a>
    <li ><a href="#method-i-any_to_s">#any_to_s</a>
    <li ><a href="#method-i-check_insecure_method">#check_insecure_method</a>
    <li ><a href="#method-i-error_print">#error_print</a>
    <li ><a href="#method-i-here-3F">#here?</a>
    <li ><a href="#method-i-insecure_method-3F">#insecure_method?</a>
    <li ><a href="#method-i-main_loop">#main_loop</a>
    <li ><a href="#method-i-run">#run</a>
    <li ><a href="#method-i-shutdown">#shutdown</a>
    <li ><a href="#method-i-stop_service">#stop_service</a>
    <li ><a href="#method-i-to_id">#to_id</a>
    <li ><a href="#method-i-to_obj">#to_obj</a>
    <li ><a href="#method-i-verbose">#verbose</a>
    <li ><a href="#method-i-verbose-3D">#verbose=</a>
  </ul>
</div>

      </div>
     </div>
    </nav>


    <div id='extraz'><div class='adzbox-index'  >
      
     </div>         
    </div>

    <main role="main" aria-labelledby="class-DRb::DRbServer">
    <h1 id="class-DRb::DRbServer" class="class">
      class DRb::DRbServer
    </h1>

    <section class="description">
    
<p>Class representing a drb server instance.</p>

<p>A DRbServer must be running in the local process before any incoming dRuby calls can be accepted, or any local objects can be passed as dRuby references to remote processes, even if those local objects are never actually called remotely. You do not need to start a DRbServer in the local process if you are only making outgoing dRuby calls passing marshalled parameters.</p>

<p>Unless multiple servers are being used, the local DRbServer is normally started by calling <a href="../DRb.html#method-c-start_service"><code>DRb.start_service</code></a>.</p>

    </section>

      <section id="5Buntitled-5D" class="documentation-section">


      <section class="constants-list">
      <header>
      <h3>Constants</h3>
      </header>
      <dl>
          <dt id="INSECURE_METHOD">INSECURE_METHOD
          <dd><p>List of insecure methods.</p>

<p>These methods are not callable via dRuby.</p>
        </dl>
        </section>

        <section class="attribute-method-details" class="method-section">
        <header>
        <h3>Attributes</h3>
        </header>

          <div id="attribute-i-config" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">config</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The configuration of this DRbServer</p>
              </div>
            </div>
          <div id="attribute-i-front" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">front</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The front object of the DRbServer.</p>

<p>This object receives remote method calls made on the server’s URI alone, with an object id.</p>
              </div>
            </div>
          <div id="attribute-i-thread" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">thread</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The main thread of this DRbServer.</p>

<p>This is the thread that listens for and accepts connections from clients, not that handles each client’s request-response session.</p>
              </div>
            </div>
          <div id="attribute-i-uri" class="method-detail">
            <div class="method-heading attribute-method-heading">
              <span class="method-name">uri</span><span
                class="attribute-access-type">[R]</span>
            </div>

            <div class="method-description">
              <p>The URI of this DRbServer.</p>
              </div>
            </div>
            </section>


                <section id="public-class-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Class Methods</h3>
                </header>

                  <div id="method-c-default_acl" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_acl</span><span
                                class="method-args">(acl)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set the default access control list to <code>acl</code>.  The default <a href="../ACL.html"><code>ACL</code></a> is <code>nil</code>.</p>

<p>See also <a href="../ACL.html"><code>DRb::ACL</code></a> and new()</p>

                              <div class="method-source-code" id="default_acl-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1374</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_acl</span>(<span class="ruby-identifier">acl</span>)
  <span class="ruby-identifier">@@acl</span> = <span class="ruby-identifier">acl</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_argc_limit" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_argc_limit</span><span
                                class="method-args">(argc)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set the default value for the :argc_limit option.</p>

<p>See new().  The initial default value is 256.</p>

                              <div class="method-source-code" id="default_argc_limit-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1360</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_argc_limit</span>(<span class="ruby-identifier">argc</span>)
  <span class="ruby-identifier">@@argc_limit</span> = <span class="ruby-identifier">argc</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_id_conv" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_id_conv</span><span
                                class="method-args">(idconv)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set the default value for the :id_conv option.</p>

<p>See new().  The initial default value is a <a href="DRbIdConv.html"><code>DRbIdConv</code></a> instance.</p>

                              <div class="method-source-code" id="default_id_conv-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1381</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_id_conv</span>(<span class="ruby-identifier">idconv</span>)
  <span class="ruby-identifier">@@idconv</span> = <span class="ruby-identifier">idconv</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-default_load_limit" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">default_load_limit</span><span
                                class="method-args">(sz)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set the default value for the :load_limit option.</p>

<p>See new().  The initial default value is 25 MB.</p>

                              <div class="method-source-code" id="default_load_limit-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1367</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">default_load_limit</span>(<span class="ruby-identifier">sz</span>)
  <span class="ruby-identifier">@@load_limit</span> = <span class="ruby-identifier">sz</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-new" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">new</span><span
                                class="method-args">(uri=nil, front=nil, config_or_acl=nil)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Create a new DRbServer instance.</p>

<p><code>uri</code> is the URI to bind to.  This is normally of the form ‘druby://&lt;hostname&gt;:&lt;port&gt;’ where &lt;hostname&gt; is a hostname of the local machine.  If nil, then the system’s default hostname will be bound to, on a port selected by the system; these value can be retrieved from the <code>uri</code> attribute.  ‘druby:’ specifies the default dRuby transport protocol: another protocol, such as ‘drbunix:’, can be specified instead.</p>

<p><code>front</code> is the front object for the server, that is, the object to which remote method calls on the server will be passed.  If nil, then the server will not accept remote method calls.</p>

<p>If <code>config_or_acl</code> is a hash, it is the configuration to use for this server.  The following options are recognised:</p>
<dl class="rdoc-list note-list"><dt>:idconv 
<dd>
<p>an id-to-object conversion object.  This defaults to an instance of the class <a href="DRbIdConv.html"><code>DRb::DRbIdConv</code></a>.</p>
</dd><dt>:verbose 
<dd>
<p>if true, all unsuccessful remote calls on objects in the server will be logged to $stdout. false by default.</p>
</dd><dt>:tcp_acl 
<dd>
<p>the access control list for this server.  See the <a href="../ACL.html"><code>ACL</code></a> class from the main dRuby distribution.</p>
</dd><dt>:load_limit 
<dd>
<p>the maximum message size in bytes accepted by the server.  Defaults to 25 MB (26214400).</p>
</dd><dt>:argc_limit 
<dd>
<p>the maximum number of arguments to a remote method accepted by the server.  Defaults to 256.</p>
</dd></dl>

<p>The default values of these options can be modified on a class-wide basis by the class methods default_argc_limit, default_load_limit, default_acl, default_id_conv, and <a href="DRbServer.html#method-i-verbose-3D"><code>verbose=</code></a></p>

<p>If <code>config_or_acl</code> is not a hash, but is not nil, it is assumed to be the access control list for this server. See the :tcp_acl option for more details.</p>

<p>If no other server is currently set as the primary server, this will become the primary server.</p>

<p>The server will immediately start running in its own thread.</p>

                              <div class="method-source-code" id="new-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1450</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">initialize</span>(<span class="ruby-identifier">uri</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">front</span>=<span class="ruby-keyword">nil</span>, <span class="ruby-identifier">config_or_acl</span>=<span class="ruby-keyword">nil</span>)
  <span class="ruby-keyword">if</span> <span class="ruby-constant">Hash</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">config_or_acl</span>
    <span class="ruby-identifier">config</span> = <span class="ruby-identifier">config_or_acl</span>.<span class="ruby-identifier">dup</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">acl</span> = <span class="ruby-identifier">config_or_acl</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">@@acl</span>
    <span class="ruby-identifier">config</span> = {
      <span class="ruby-value">:tcp_acl</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">acl</span>
    }
  <span class="ruby-keyword">end</span>

  <span class="ruby-ivar">@config</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">class</span>.<span class="ruby-identifier">make_config</span>(<span class="ruby-identifier">config</span>)

  <span class="ruby-ivar">@protocol</span> = <span class="ruby-constant">DRbProtocol</span>.<span class="ruby-identifier">open_server</span>(<span class="ruby-identifier">uri</span>, <span class="ruby-ivar">@config</span>)
  <span class="ruby-ivar">@uri</span> = <span class="ruby-ivar">@protocol</span>.<span class="ruby-identifier">uri</span>
  <span class="ruby-ivar">@exported_uri</span> = [<span class="ruby-ivar">@uri</span>]

  <span class="ruby-ivar">@front</span> = <span class="ruby-identifier">front</span>
  <span class="ruby-ivar">@idconv</span> = <span class="ruby-ivar">@config</span>[<span class="ruby-value">:idconv</span>]

  <span class="ruby-ivar">@grp</span> = <span class="ruby-constant">ThreadGroup</span>.<span class="ruby-identifier">new</span>
  <span class="ruby-ivar">@thread</span> = <span class="ruby-identifier">run</span>

  <span class="ruby-constant">DRb</span>.<span class="ruby-identifier">regist_server</span>(<span class="ruby-keyword">self</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-verbose" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">verbose</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Get the default value of the :verbose option.</p>

                              <div class="method-source-code" id="verbose-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1393</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">verbose</span>
  <span class="ruby-identifier">@@verbose</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-c-verbose-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">verbose=</span><span
                                class="method-args">(on)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set the default value of the :verbose option.</p>

<p>See new().  The initial default value is false.</p>

                              <div class="method-source-code" id="verbose-3D-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1388</span>
<span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier ruby-title">verbose=</span>(<span class="ruby-identifier">on</span>)
  <span class="ruby-identifier">@@verbose</span> = <span class="ruby-identifier">on</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="public-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Public Instance Methods</h3>
                </header>

                  <div id="method-i-alive-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">alive?</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Is this server alive?</p>

                              <div class="method-source-code" id="alive-3F-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1505</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">alive?</span>
  <span class="ruby-ivar">@thread</span>.<span class="ruby-identifier">alive?</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-check_insecure_method" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">check_insecure_method</span><span
                                class="method-args">(obj, msg_id)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Check that a method is callable via dRuby.</p>

<p><code>obj</code> is the object we want to invoke the method on. <code>msg_id</code> is the method name, as a Symbol.</p>

<p>If the method is an insecure method (see <a href="DRbServer.html#method-i-insecure_method-3F"><code>insecure_method?</code></a>) a SecurityError is thrown.  If the method is private or undefined, a NameError is thrown.</p>

                              <div class="method-source-code" id="check_insecure_method-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1593</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">check_insecure_method</span>(<span class="ruby-identifier">obj</span>, <span class="ruby-identifier">msg_id</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">true</span> <span class="ruby-keyword">if</span> <span class="ruby-constant">Proc</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">obj</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">msg_id</span> <span class="ruby-operator">==</span> <span class="ruby-value">:__drb_yield</span>
  <span class="ruby-identifier">raise</span>(<span class="ruby-constant">ArgumentError</span>, <span class="ruby-node">&quot;#{any_to_s(msg_id)} is not a symbol&quot;</span>) <span class="ruby-keyword">unless</span> <span class="ruby-constant">Symbol</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">msg_id</span>.<span class="ruby-identifier">class</span>
  <span class="ruby-identifier">raise</span>(<span class="ruby-constant">SecurityError</span>, <span class="ruby-node">&quot;insecure method `#{msg_id}&#39;&quot;</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">insecure_method?</span>(<span class="ruby-identifier">msg_id</span>)

  <span class="ruby-keyword">case</span> <span class="ruby-identifier">obj</span>
  <span class="ruby-keyword">when</span> <span class="ruby-constant">Object</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">private_methods</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">msg_id</span>)
      <span class="ruby-identifier">desc</span> = <span class="ruby-identifier">any_to_s</span>(<span class="ruby-identifier">obj</span>)
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoMethodError</span>, <span class="ruby-node">&quot;private method `#{msg_id}&#39; called for #{desc}&quot;</span>
    <span class="ruby-keyword">elsif</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">protected_methods</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">msg_id</span>)
      <span class="ruby-identifier">desc</span> = <span class="ruby-identifier">any_to_s</span>(<span class="ruby-identifier">obj</span>)
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoMethodError</span>, <span class="ruby-node">&quot;protected method `#{msg_id}&#39; called for #{desc}&quot;</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-keyword">true</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-keyword">if</span> <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">instance_method</span>(<span class="ruby-value">:private_methods</span>).<span class="ruby-identifier">bind</span>(<span class="ruby-identifier">obj</span>).<span class="ruby-identifier">call</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">msg_id</span>)
      <span class="ruby-identifier">desc</span> = <span class="ruby-identifier">any_to_s</span>(<span class="ruby-identifier">obj</span>)
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoMethodError</span>, <span class="ruby-node">&quot;private method `#{msg_id}&#39; called for #{desc}&quot;</span>
    <span class="ruby-keyword">elsif</span> <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">instance_method</span>(<span class="ruby-value">:protected_methods</span>).<span class="ruby-identifier">bind</span>(<span class="ruby-identifier">obj</span>).<span class="ruby-identifier">call</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">msg_id</span>)
      <span class="ruby-identifier">desc</span> = <span class="ruby-identifier">any_to_s</span>(<span class="ruby-identifier">obj</span>)
      <span class="ruby-identifier">raise</span> <span class="ruby-constant">NoMethodError</span>, <span class="ruby-node">&quot;protected method `#{msg_id}&#39; called for #{desc}&quot;</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-keyword">true</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-here-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">here?</span><span
                                class="method-args">(uri)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Is <code>uri</code> the URI for this server?</p>

                              <div class="method-source-code" id="here-3F-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1510</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">here?</span>(<span class="ruby-identifier">uri</span>)
  <span class="ruby-ivar">@exported_uri</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">uri</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-stop_service" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">stop_service</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Stop this server.</p>

                              <div class="method-source-code" id="stop_service-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1515</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">stop_service</span>
  <span class="ruby-constant">DRb</span>.<span class="ruby-identifier">remove_server</span>(<span class="ruby-keyword">self</span>)
  <span class="ruby-keyword">if</span>  <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-string">&#39;DRb&#39;</span>] <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-string">&#39;DRb&#39;</span>][<span class="ruby-string">&#39;server&#39;</span>] <span class="ruby-operator">==</span> <span class="ruby-keyword">self</span>
    <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-string">&#39;DRb&#39;</span>][<span class="ruby-string">&#39;stop_service&#39;</span>] = <span class="ruby-keyword">true</span>
  <span class="ruby-keyword">else</span>
    <span class="ruby-identifier">shutdown</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_id" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">to_id</span><span
                                class="method-args">(obj)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Convert a local object to a dRuby reference.</p>

                              <div class="method-source-code" id="to_id-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1532</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_id</span>(<span class="ruby-identifier">obj</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">obj</span>.<span class="ruby-identifier">__id__</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">front</span>.<span class="ruby-identifier">__id__</span>
  <span class="ruby-ivar">@idconv</span>.<span class="ruby-identifier">to_id</span>(<span class="ruby-identifier">obj</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-to_obj" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">to_obj</span><span
                                class="method-args">(ref)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Convert a dRuby reference to the local object it refers to.</p>

                              <div class="method-source-code" id="to_obj-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1525</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">to_obj</span>(<span class="ruby-identifier">ref</span>)
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">front</span> <span class="ruby-keyword">if</span> <span class="ruby-identifier">ref</span>.<span class="ruby-identifier">nil?</span>
  <span class="ruby-keyword">return</span> <span class="ruby-identifier">front</span>[<span class="ruby-identifier">ref</span>.<span class="ruby-identifier">to_s</span>] <span class="ruby-keyword">if</span> <span class="ruby-constant">DRbURIOption</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">ref</span>
  <span class="ruby-ivar">@idconv</span>.<span class="ruby-identifier">to_obj</span>(<span class="ruby-identifier">ref</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-verbose" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">verbose</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Get whether the server is in verbose mode.</p>

<p>In verbose mode, failed calls are logged to stdout.</p>

                              <div class="method-source-code" id="verbose-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1502</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">verbose</span>; <span class="ruby-ivar">@config</span>[<span class="ruby-value">:verbose</span>]; <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-verbose-3D" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">verbose=</span><span
                                class="method-args">(v)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Set whether to operate in verbose mode.</p>

<p>In verbose mode, failed calls are logged to stdout.</p>

                              <div class="method-source-code" id="verbose-3D-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1497</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">verbose=</span>(<span class="ruby-identifier">v</span>); <span class="ruby-ivar">@config</span>[<span class="ruby-value">:verbose</span>]=<span class="ruby-identifier">v</span>; <span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

                <section id="private-instance-5Buntitled-5D-method-details" class="method-section">
                <header>
                <h3>Private Instance Methods</h3>
                </header>

                  <div id="method-i-any_to_s" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">any_to_s</span><span
                                class="method-args">(obj)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Coerce an object to a string, providing our own representation if to_s is not defined for the object.</p>

                              <div class="method-source-code" id="any_to_s-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1579</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">any_to_s</span>(<span class="ruby-identifier">obj</span>)
  <span class="ruby-node">&quot;#{obj}:#{obj.class}&quot;</span>
<span class="ruby-keyword">rescue</span>
  <span class="ruby-constant">Kernel</span>.<span class="ruby-identifier">instance_method</span>(<span class="ruby-value">:to_s</span>).<span class="ruby-identifier">bind_call</span>(<span class="ruby-identifier">obj</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-error_print" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">error_print</span><span
                                class="method-args">(exception)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="error_print-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1695</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">error_print</span>(<span class="ruby-identifier">exception</span>)
  <span class="ruby-identifier">exception</span>.<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">inject</span>(<span class="ruby-keyword">true</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">first</span>, <span class="ruby-identifier">x</span><span class="ruby-operator">|</span>
    <span class="ruby-keyword">if</span> <span class="ruby-identifier">first</span>
      <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;#{x}: #{exception} (#{exception.class})&quot;</span>
    <span class="ruby-keyword">else</span>
      <span class="ruby-identifier">$stderr</span>.<span class="ruby-identifier">puts</span> <span class="ruby-node">&quot;\tfrom #{x}&quot;</span>
    <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">false</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-insecure_method-3F" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">insecure_method?</span><span
                                class="method-args">(msg_id)</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Has a method been included in the list of insecure methods?</p>

                              <div class="method-source-code" id="insecure_method-3F-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1573</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">insecure_method?</span>(<span class="ruby-identifier">msg_id</span>)
  <span class="ruby-constant">INSECURE_METHOD</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">msg_id</span>)
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-main_loop" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">main_loop</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>The main loop performed by a DRbServer’s internal thread.</p>

<p>Accepts a connection from a client, and starts up its own thread to handle it.  This thread loops, receiving requests from the client, invoking them on a local object, and returning responses, until the client closes the connection or a local method call fails.</p>

                              <div class="method-source-code" id="main_loop-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1713</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">main_loop</span>
  <span class="ruby-identifier">client0</span> = <span class="ruby-ivar">@protocol</span>.<span class="ruby-identifier">accept</span>
  <span class="ruby-keyword">return</span> <span class="ruby-keyword">nil</span> <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">client0</span>
  <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">start</span>(<span class="ruby-identifier">client0</span>) <span class="ruby-keyword">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">client</span><span class="ruby-operator">|</span>
    <span class="ruby-ivar">@grp</span>.<span class="ruby-identifier">add</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>
    <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-string">&#39;DRb&#39;</span>] = { <span class="ruby-string">&#39;client&#39;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">client</span> ,
                              <span class="ruby-string">&#39;server&#39;</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-keyword">self</span> }
    <span class="ruby-constant">DRb</span>.<span class="ruby-identifier">mutex</span>.<span class="ruby-identifier">synchronize</span> <span class="ruby-keyword">do</span>
      <span class="ruby-identifier">client_uri</span> = <span class="ruby-identifier">client</span>.<span class="ruby-identifier">uri</span>
      <span class="ruby-ivar">@exported_uri</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-identifier">client_uri</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@exported_uri</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">client_uri</span>)
    <span class="ruby-keyword">end</span>
    <span class="ruby-identifier">_last_invoke_method</span> = <span class="ruby-keyword">nil</span>
    <span class="ruby-identifier">loop</span> <span class="ruby-keyword">do</span>
      <span class="ruby-keyword">begin</span>
        <span class="ruby-identifier">succ</span> = <span class="ruby-keyword">false</span>
        <span class="ruby-identifier">invoke_method</span> = <span class="ruby-constant">InvokeMethod</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword">self</span>, <span class="ruby-identifier">client</span>)
        <span class="ruby-identifier">succ</span>, <span class="ruby-identifier">result</span> = <span class="ruby-identifier">invoke_method</span>.<span class="ruby-identifier">perform</span>
        <span class="ruby-identifier">error_print</span>(<span class="ruby-identifier">result</span>) <span class="ruby-keyword">if</span> <span class="ruby-operator">!</span><span class="ruby-identifier">succ</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">verbose</span>
        <span class="ruby-keyword">unless</span> <span class="ruby-constant">DRbConnError</span> <span class="ruby-operator">===</span> <span class="ruby-identifier">result</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">result</span>.<span class="ruby-identifier">message</span> <span class="ruby-operator">==</span> <span class="ruby-string">&#39;connection closed&#39;</span>
          <span class="ruby-identifier">client</span>.<span class="ruby-identifier">send_reply</span>(<span class="ruby-identifier">succ</span>, <span class="ruby-identifier">result</span>)
        <span class="ruby-keyword">end</span>
      <span class="ruby-keyword">rescue</span> <span class="ruby-constant">Exception</span> <span class="ruby-operator">=&gt;</span> <span class="ruby-identifier">e</span>
        <span class="ruby-identifier">error_print</span>(<span class="ruby-identifier">e</span>) <span class="ruby-keyword">if</span> <span class="ruby-identifier">verbose</span>
      <span class="ruby-keyword">ensure</span>
        <span class="ruby-identifier">_last_invoke_method</span> = <span class="ruby-identifier">invoke_method</span>
        <span class="ruby-identifier">client</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">succ</span>
        <span class="ruby-keyword">if</span> <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>[<span class="ruby-string">&#39;DRb&#39;</span>][<span class="ruby-string">&#39;stop_service&#39;</span>]
          <span class="ruby-identifier">shutdown</span>
          <span class="ruby-keyword">break</span>
        <span class="ruby-keyword">end</span>
        <span class="ruby-keyword">break</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">succ</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-run" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">run</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              <p>Starts the <a href="../DRb.html"><code>DRb</code></a> main loop in a new thread.</p>

                              <div class="method-source-code" id="run-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1554</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">run</span>
  <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">start</span> <span class="ruby-keyword">do</span>
    <span class="ruby-keyword">begin</span>
      <span class="ruby-keyword">while</span> <span class="ruby-identifier">main_loop</span>
      <span class="ruby-keyword">end</span>
    <span class="ruby-keyword">ensure</span>
      <span class="ruby-ivar">@protocol</span>.<span class="ruby-identifier">close</span> <span class="ruby-keyword">if</span> <span class="ruby-ivar">@protocol</span>
    <span class="ruby-keyword">end</span>
  <span class="ruby-keyword">end</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                  <div id="method-i-shutdown" class="method-detail ">
                            <div class="method-heading">
                              <span class="method-name">shutdown</span><span
                                class="method-args">()</span>
                              <span class="method-click-advice">click to toggle source</span>
                            </div>

                            <div class="method-description">
                              

                              <div class="method-source-code" id="shutdown-source">
            <pre><span class="ruby-comment"># File drb/drb.rb, line 1539</span>
<span class="ruby-keyword">def</span> <span class="ruby-identifier ruby-title">shutdown</span>
  <span class="ruby-identifier">current</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">current</span>
  <span class="ruby-keyword">if</span> <span class="ruby-ivar">@protocol</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-value">:shutdown</span>
    <span class="ruby-ivar">@protocol</span>.<span class="ruby-identifier">shutdown</span>
  <span class="ruby-keyword">else</span>
    [<span class="ruby-ivar">@thread</span>, <span class="ruby-operator">*</span><span class="ruby-ivar">@grp</span>.<span class="ruby-identifier">list</span>].<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">thread</span><span class="ruby-operator">|</span>
      <span class="ruby-identifier">thread</span>.<span class="ruby-identifier">kill</span> <span class="ruby-keyword">unless</span> <span class="ruby-identifier">thread</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">current</span> <span class="ruby-comment"># xxx: Thread#kill</span>
    }
  <span class="ruby-keyword">end</span>
  <span class="ruby-ivar">@thread</span>.<span class="ruby-identifier">join</span> <span class="ruby-keyword">unless</span> <span class="ruby-ivar">@thread</span> <span class="ruby-operator">==</span> <span class="ruby-identifier">current</span>
<span class="ruby-keyword">end</span></pre>
                              </div>
                            </div>


                          </div>

                          </section>

              </section>
              </main>



            </div>  <!--  class='wrapper hdiv' -->


<footer id="validator-badges" role="contentinfo">
<p><a href="https://validator.w3.org/check/referer">Validate</a></p>
<p>Generated by <a href="https://ruby.github.io/rdoc/">RDoc</a> 6.4.0.</p>
<p>Based on <a href="https://github.com/ged/darkfish/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.</p>

  
    <p><p><a href="https://ruby-doc.org">Ruby-doc.org</a> is a service of <a href="https://jamesbritt.com">James Britt</a> and <a href="https://neurogami.com">Neurogami</a>, purveyors of fine <a href='https://jamesbritt.bandcamp.com/'>dance noise</a></p>
</p>
  
  </footer>

<script type="text/javascript">


  let ads  = $("#carbonads-container").children().detach();


  function swapMode() {
    var cookieName = 'darkmode';
    var cssDarkmode = Cookies.get(cookieName);
    console.log("***** swapMode! " + cssDarkmode + " *****");


    if (cssDarkmode == "true") {
      console.log("We have dark mode, set the css to light ...");
      $('#rdoccss').attr("href", defaultModeCssHref);
      $('#cssSelect').text("Dark mode");
      cssDarkmode = "false";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    } else {
      console.log("We not have dark mode, set the css to dark ...");
      $('#rdoccss').attr("href", darkModeCsseHref);
      $('#cssSelect').text("Light mode");
      cssDarkmode = "true";
      console.log("swapMode! Now set cookie to " + cssDarkmode);
      Cookies.set(cookieName, cssDarkmode);

    }

    console.log("  --------------- ");
  }


const vueCssApp = new Vue({
el: '#menubar',
data: {
isDark: false
},
methods: {
toggleClass: function(event){
this.isDark = !this.isDark;
}
}
})

const vueApp = new Vue({
el: '#vapp',
data: { 
isOpen: true
},

mounted() {
this.handleResize();
this.manage_mob_classes();
window.addEventListener('resize', this.handleResize)
//this.isOpen !=  (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},
destroyed() {
window.removeEventListener('resize', this.handleResize)
},
created() {
//manage_mob_classes();
},

methods : {
isMobile() {
  return (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent));
},

  handleResize() {
    if (!this.isMobile()) {
      this.isOpen = window.innerWidth > 800;
    }
  },

  manage_mob_classes() {
    if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
      $("nav").addClass("mob_nav");
      $("main").addClass("mob_main");
      $("#extraz").addClass("mob_extraz");
      $("#carbonads-container").addClass("mob_carbonads-container");
      this.isOpen  = false;
    } else {
      $("nav").removeClass("mob_nav") 
        $("main").removeClass("mob_main");
      $("#extraz").removeClass("mob_extraz");
      $("#carbonads-container").removeClass("mob_carbonads-container");
      this.isOpen  = true;
    }
  },

  toggleNav() {
    this.isOpen =! this.isOpen ;
    // alert("Toggle nav!");
    console.log("toggleNav() click: " + this.isOpen );
  }
}
})

$("#carbonads-container").append(ads);


$(function() {

    var darkmode = Cookies.get("darkmode");
    console.log("Document ready: " + darkmode);

    if ( darkmode  == "true" ) {
      $('#cssSelect').text("Light mode");
    } else {
      $('#cssSelect').text("Dark mode");
     }

    $('body').css('display','block');
    });

</script>

    
  </body> 
</html>

